home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / w3 / w3-style.el.z / w3-style.el
Encoding:
Text File  |  1998-05-21  |  2.7 KB  |  77 lines

  1. ;;; w3-style.el --- Emacs-W3 binding style sheet mechanism
  2. ;; Author: wmperry
  3. ;; Created: 1997/12/24 16:29:23
  4. ;; Version: 1.29
  5. ;; Keywords: faces, hypermedia
  6.  
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
  9. ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
  10. ;;;
  11. ;;; This file is part of GNU Emacs.
  12. ;;;
  13. ;;; GNU Emacs is free software; you can redistribute it and/or modify
  14. ;;; it under the terms of the GNU General Public License as published by
  15. ;;; the Free Software Foundation; either version 2, or (at your option)
  16. ;;; any later version.
  17. ;;;
  18. ;;; GNU Emacs is distributed in the hope that it will be useful,
  19. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. ;;; GNU General Public License for more details.
  22. ;;;
  23. ;;; You should have received a copy of the GNU General Public License
  24. ;;; along with GNU Emacs; see the file COPYING.  If not, write to the
  25. ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  26. ;;; Boston, MA 02111-1307, USA.
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28.  
  29. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  30. ;;; A style sheet mechanism for emacs-w3
  31. ;;;
  32. ;;; This will eventually be able to under DSSSL[-lite] as well as the
  33. ;;; experimental W3C mechanism
  34. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  35. (require 'font)
  36. (require 'w3-keyword)
  37. (require 'cl)
  38. (require 'css)
  39.  
  40.  
  41.  
  42. ;;;###autoload
  43. (defun w3-handle-style (&optional plist)
  44.   (let ((url (or (plist-get plist 'href)
  45.          (plist-get plist 'src)
  46.          (plist-get plist 'uri)))
  47.     (media (intern (downcase (or (plist-get plist 'media) "all"))))
  48.     (type (downcase (or (plist-get plist 'notation) "text/css")))
  49.     (url-working-buffer " *style*")
  50.     (stylesheet nil)
  51.     (defines nil)
  52.     (cur-sheet w3-current-stylesheet)
  53.     (string (plist-get plist 'data)))
  54.     (if (not (memq media (css-active-device-types)))
  55.     nil                ; Not applicable to us!
  56.       (save-excursion
  57.     (set-buffer (get-buffer-create url-working-buffer))
  58.     (erase-buffer)
  59.     (setq url-be-asynchronous nil)
  60.     (cond
  61.      ((member type '("experimental" "arena" "w3c-style" "css" "text/css"))
  62.       (setq stylesheet (css-parse url string cur-sheet)))
  63.      (t
  64.       (w3-warn 'html "Unknown stylesheet notation: %s" type))))
  65.       (setq w3-current-stylesheet stylesheet))))
  66.  
  67. ;;;###autoload
  68. (defun w3-display-stylesheet (&optional sheet)
  69.   "Display the stylesheet for the current document."
  70.   (interactive)
  71.   (setq sheet (or sheet w3-current-stylesheet w3-user-stylesheet))
  72.   (if (not sheet)
  73.       (error "No stylesheet available!"))
  74.   (css-display sheet))
  75.  
  76. (provide 'w3-style)
  77.